/*=============================================================================

  Library: HMPBundleFrame

  Copyright (c) German Cancer Research Center,
    Division of Medical and Biological Informatics

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

=============================================================================*/


#ifndef SERVICESLOTENTRY_P_H
#define SERVICESLOTENTRY_P_H


#include <QHash>
#include <QList>
#include <QString>
#include <QStringList>
#include <QExplicitlySharedDataPointer>

#include "ServiceEvent.h"
#include "LDAPExpr_p.h"

class IBundle;
class ServiceSlotEntryData;

class QObject;


/**
 * \ingroup BundleFramework
 *
 * Data structure for saving information about slots registered for
 * receiving service lifecycle events.
 */
class ServiceSlotEntry
{

public:

  ServiceSlotEntry(QSharedPointer<IBundle> p, QObject* receiver, const char* slot,
                      const QString& filter = QString());

  ServiceSlotEntry(const ServiceSlotEntry& other);

  // default constructor for use in QSet
  ServiceSlotEntry();
  ~ServiceSlotEntry();

  // assignment operator for use in QSet
  ServiceSlotEntry& operator=(const ServiceSlotEntry& other);

  bool operator==(const ServiceSlotEntry& other) const;

  void invokeSlot(const ServiceEvent& event);

  void setRemoved(bool removed);

  bool isRemoved() const;

  QSharedPointer<IBundle> getPlugin() const;

  LDAPExpr getLDAPExpr() const;

  QString getFilter() const;

  LDAPExpr::LocalCache& getLocalCache() const;

private:

  friend uint qHash(const ServiceSlotEntry& serviceSlot);

  QExplicitlySharedDataPointer<ServiceSlotEntryData> d;

};

/**
 * \ingroup BundleFramework
 */
uint qHash(const ServiceSlotEntry& serviceSlot);

#endif // SERVICESLOTENTRY_P_H
